package com.my.study.designPatterns.iteratorPattern;

public class DinnerMenuIterator implements Iterator<MenuItem>{

    private MenuItem [] menuItems;

    private int position = 0;

    public DinnerMenuIterator(MenuItem[] menuItems) {
        this.menuItems = menuItems;
    }


    @Override
    public Boolean hasNext() {
        if(position < menuItems.length){
            return true;
        }
        return false;
    }

    @Override
    public MenuItem next() {

        MenuItem menuItem = menuItems[position];
        position ++;
        return menuItem;
    }
}
